---
category: Level 1 — Basic
created: '2020-02-16'
keywords:
title: Create an element
---

## Create new element

```js
const ele = document.createElement('div');
```

## Create new text node

```js
const ele = document.createTextNode('Hello World!');
```

## See also

-   [Calculate the size of scrollbar](https://phuoc.ng/collection/html-dom/calculate-the-size-of-scrollbar/)
-   [Check if the native date input is supported](https://phuoc.ng/collection/html-dom/check-if-the-native-date-input-is-supported/)
-   [Copy text to the clipboard](https://phuoc.ng/collection/html-dom/copy-text-to-the-clipboard/)
-   [Download a file](https://phuoc.ng/collection/html-dom/download-a-file/)
-   [Drag and drop element in a list](https://phuoc.ng/collection/html-dom/drag-and-drop-element-in-a-list/)
-   [Drag and drop table column](https://phuoc.ng/collection/html-dom/drag-and-drop-table-column/)
-   [Drag and drop table row](https://phuoc.ng/collection/html-dom/drag-and-drop-table-row/)
-   [Measure the width of given text of given font](https://phuoc.ng/collection/html-dom/measure-the-width-of-given-text-of-given-font/)
-   [Paste as plain text](https://phuoc.ng/collection/html-dom/paste-as-plain-text/)
-   [Print an image](https://phuoc.ng/collection/html-dom/print-an-image/)
-   [Resize an image](https://phuoc.ng/collection/html-dom/resize-an-image/)
-   [Resize columns of a table](https://phuoc.ng/collection/html-dom/resize-columns-of-a-table/)
-   [Resize the width of a text box to fit its content automatically](https://phuoc.ng/collection/html-dom/resize-the-width-of-a-text-box-to-fit-its-content-automatically/)
-   [Show a ghost element when dragging an element](https://phuoc.ng/collection/html-dom/show-a-ghost-element-when-dragging-an-element/)
-   [Show or hide table columns](https://phuoc.ng/collection/html-dom/show-or-hide-table-columns/)
-   [Strip html from a given text](https://phuoc.ng/collection/html-dom/strip-html-from-a-given-text/)
